from langchain_ollama import ChatOllama
from langchain_core.prompts import ChatPromptTemplate

prompt = ChatPromptTemplate.from_template("你是一个{role},请用三句话介绍{topic}")

chat = ChatOllama(base_url="http://10.0.2.114:11434", model="deepseek-r1:7b", temperature=1.0)

chain = prompt | chat
print(chain.invoke({"role": "历史学家", "topic": "丝绸之路"}).content)
